#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    unsigned int n;
    cin >> n;
    string s = "";
    for(int i = 0; i < 32; i++) {
        if(((n >> i) & 1)) {
            s += '1';
        }else {
            s += '0';
        }
    }
    reverse(s.begin(), s.end());
    string x(s.begin(), s.begin() + 16);
    string y(s.begin() + 16, s.end());
    string s2 = y + x;
    unsigned int ret = 0;
    for(int i = s2.size() - 1, k = 0; i >= 0; i--, k++) {
        if(s2[i] == '1') {
            ret |= (1 << k);
        }
    }
    cout << ret << endl;
    return 0;
}